<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">

  </div>
  <script src="lib/vue.js"></script>
  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        title: '这是内容',
        obj: {
          content1: '内容1',
          content2: '内容2'
        },
        arr: [1, 2, 3, 4, 5]
      },
      watch: {
        title (val, oldVal) {
          console.log('title 被修改了', val, oldVal);
        },
        /* obj () {
          console.log('obj 被修改了');
        } */
        obj: {
          deep: true,
          handler (val, oldVal) {
            console.log('obj 被修改了', val, oldVal);
            console.log(val === oldVal);
          }
        },
        arr (val, oldVal) {
          console.log('arr 修改了', val, oldVal)
        },
        /* arr: {
          deep: true,
          handler (val, oldVal) {
            console.log('arr 修改了', val, oldVal)
          }
        }  */
      }
    });
  </script>
</body>
</html>